<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="us" uri="us/usws.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>睿立南方教育管理平台</title>
<link href="/ipodium-res/styles/web.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/ipodium-res/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/ipodium-res/js/ajaxupload.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	new AjaxUpload('uploadButton', {
	    action: '/ipodium/uploadVideoSnapshot',
	    name: "userFile",
		onSubmit : function(file , ext){
	        // Allow only images. You should add security check on the server-side.
			if (ext && /^(jpg|png|jpeg|gif)$/.test(ext.toLowerCase())){
				/* Setting data */
				this.setData({
					'ext': ext,
					'file': file,
					'type':'ipodiumVideoSnapshot'
				});					
				this.disable();	
			} else {					
				// extension is not allowed
				$('#snapshotMsg').text('错误：只允许上传图片文件。');
				// cancel upload
				return false;				
			}
		},
		onComplete : function(file){
			$('#snapshotMsg').text('上传文件成功：'+file);
			$('#vo_snapshotPath').val(file);
			$('#previewSnapshotImg').html("<img width='150' height='110' src='/tmp/<s:property value="#session.ipodium_user.uid"/>/"+file+"'>");
			this.enable();
			//refresh();
		}		
	});
	new AjaxUpload('uploadVideoButton', {
	    action: '/ipodium/uploadVideoSnapshot',
	    name: "userFile",
		onSubmit : function(file , ext){
	        // Allow only images. You should add security check on the server-side.
			if (ext && /^(mp4|avi|flv|3gp|mkv|3gpp)$/.test(ext.toLowerCase())){
				/* Setting data */
				this.setData({
					'ext': ext,
					'file': file,
					'type':'ipodiumVideo'
				});					
				this.disable();	
			} else {					
				// extension is not allowed
				$('#videoMsg').text('错误：只允许上传视频文件。');
				// cancel upload
				return false;				
			}
		},
		onComplete : function(file){
			$('#videoMsg').text('上传文件成功：'+file);
			$('#vo_videoPath').val(file);
			this.enable();
			//refresh();
		}		
	});
});
</script>
</head>
<body>
<div class="Rightframe">
<div class="title">首页 > 视频管理 >  添加/编辑</div>
<div class="addtt">添加新视频</div>
<s:form action="addVideoCommit">
<s:hidden name="vo.typeDsid"/>
<s:hidden name="vo.catUid"/>
<s:hidden name="vo.catCN"/>
<s:hidden name="vo.videoTypeCN"/>
<s:hidden name="vo.snapshotPath" id="vo_snapshotPath"/>
<s:hidden name="vo.videoPath" id="vo_videoPath"/>
<div class="leftlist"><s:debug />
<dl>视频标题：</dl><ol><s:textfield name="vo.title" cssStyle="color:#999999" cssClass="put1" />
<s:if test="fieldErrors.vo.title.size>0"><s:fielderror fieldName="vo.title" /></s:if>
<s:else><span>*视频标题不能超过50个字符，必须以中文开头</span></s:else>
</ol>
<dl>视频简介：</dl><ol><s:textarea name="vo.descriptoin" cssClass="nops"></s:textarea></ol>
<dl>视频类型：</dl><ol><s:property value="vo.videoTypeCN"/> - <s:property value="vo.catCN" /></ol>
<s:iterator id="ev" value="extattrs">
<dl><s:property value="#ev.label"/>：</dl><ol>
<us:videotypeextra value="#ev" recMap="recvals"/>
</ol>
</s:iterator>
<dl>视频标签：</dl>
<ol><s:textfield name="vo.tags" cssStyle="color:#999999" cssClass="put2" /><br />
<s:if test="fieldErrors.vo.tags.size>0"><s:fielderror fieldName="vo.tags" /></s:if>
<s:else><span>*视频标签请用英文状态下的空格分隔</span></s:else>
</ol>
<dl>视频缩略图：</dl><ol><input type="text" id="" name="" value="C:\" onFocus="if(value==defaultValue){value='';this.style.color='#05469A'}" onBlur="if(!value){value=defaultValue;this.style.color='#999'}" style="color:#999999" class="put1" />
<input id="uploadButton" class="addbtn" id="btn" value="预览" /><div id="snapshotMsg"></div>
<br />
<span>*如不上传视频缩略图，则默认显示系统默认图片，图片尺寸为4：3，请上传高清图<br />
片，最大支持2M</span>
</ol>
<dl>视频文件：</dl><ol><input type="text" id="" name="" value="C:\" onFocus="if(value==defaultValue){value='';this.style.color='#05469A'}" onBlur="if(!value){value=defaultValue;this.style.color='#999'}" style="color:#999999" class="put1" />
<input id="uploadVideoButton"  class="addbtn" id="btn" value="预览" /><div id="videoMsg"></div>
<br />
<span>*最大支持20M，支持格式为MP4,AVI</span>
</ol>
</div>
<div class="preview">
<div class="previewtu" id="previewSnapshotImg"></div>
<div class="previewzi">
图片大小：125KB<br />
图片名称：1255483.jpg
</div>
</div>
<div class="preview">
<div class="previewtu" id="previewVideoDiv"></div>
<div class="previewzi">
视频大小：125KB<br />
视频名称：1255483.jpg
</div>
</div>
<div class="bottom">
<input name="btn" type="submit" class="tijiao" id="btn" value="上传" />
<input name="btn" type="submit" class="cancel" id="btn" value="返回" /></div>
</s:form>
</div>


</body>
</html>
